<layout name="Layout/main"/>
<style>
    .del:hover{border:red solid 1px; background-color: red}
    .del{width:20px;border: #fff solid 1px;clear:both;}
    .pass:hover{border:#36bc9b solid 1px; background-color: #36bc9b}
    .pass{width:20px;border: #fff solid 1px;clear:both;}
</style>
<div class="content" style="height: 800px">
    <table id="ency_list">
        <thead>
         <form id="search" class="search-form" action="__APP__/admin/pet/ency" method="post">
             <div style="margin:20px 0 20px 300px;color: #000;">
             <span>宠物名称：</span><input name="pet_name" type="text" class="search-input" style="color: #000;"/>
             <span>宠物种类：<select name="category">
                     <option value="0">--请选择--</option>
                     <?php foreach($cate_list as $k => $v){?>
                     <option value="<?php echo $v['id']?>"><?php echo $v['name']?></option>
                     <?php } ?>
                 </select>
             </span>
             <input type="submit" value="查询" class="search-input-btn" style="margin-left:400px;margin-top:-23px "/>
             </div>
         </form>

        </thead>
        <tbody>
            <tr>
                <th></th>
                <th class="text_100">编号</th>
                <th class="text_100">会员账号</th>
                <th class="text_250">姓名</th>
                <th class="text_250">等级</th>
                <th class="text_250">审核通过</th>
                <th class="text_200">证件照</th>
                <th class="text_200">资格证照片</th>
                <th class="text_200">医生积分</th>
                <th class="text_500">操作</th>
            </tr>
            <?php foreach($doctor as $k => $v){ $i += 1;?>
           <tr>
               <td></td>
               <td><?php echo $i ?></td>
               <td><?php echo $v['user_name']?></td>
               <td><?php echo $v['name']?></td>
               <td><?php echo $v['level']?></td>
               <td><?php echo $v['ifpass'] == 1 ?'是':($v['ifpass'] == 2 ? '否' : '待审核')?></td>
               <td><img src="__PUBLIC__/img/pet/<?php echo $v['photo']?>" width="50px" height="50px"/></td>
               <td><img src="__PUBLIC__/img/pet/<?php echo $v['qualficate_photo']?>" width="50px" height="50px"/></td>
               <td><?php echo $v['points']?></td>
               <td width="100px">
                   <?php if($v['ifpass'] == '0'){?>
                   <a title="审核通过" href="javascript:void(0);"  class="pass" data-pass="pass" data-id="<?php echo $v['id']?>"><i class="fa fa-check-circle"></i></a>
                   <a title="审核不通过" href="javascript:void(0);" class="pass" data-pass="nopass" data-id="<?php echo $v['id']?>"><i class="fa fa-times"></i></a>
                   <?php } ?>
                   <a title="删除" class="del" enc_type="del" href="javascript:void(0)" data-id="<?php echo $v['id']?>"><i class="fa fa-trash"></i></a>
               </td>
           </tr>
        <?php }?>
        </tbody>
    </table>
</div>
<script>
    $("a[enc_type='del']").click(function(){
        var id = $(this).attr('data-id');
        $.post('__APP__/admin/doctor/del',{id:id},function(result){
            if(result == 'true'){
                sweetAlert('删除成功');
            }else{
                sweetAlert('删除失败');
            }
            location.reload();
        });
    });
    $(".pass").click(function(){
        var if_pass = $(this).attr('data-pass');
        var id = $(this).attr('data-id');
        $.post('__APP__/admin/doctor/verify',{if_pass:if_pass,id:id},function(result){
            if(result == 'true'){
                sweetAlert('操作成功');
            }else{
                sweetAlert('操作失败');
            }
            location.reload();
        });
    });
</script>